package com.design.访问者模式;

import java.util.ArrayList;
import java.util.List;

public class ObjectStructure {

	private List<Node> nodes;
	
	public ObjectStructure() {
		this.nodes = new ArrayList<>();
	}

	public void addNode(Node node) {
		this.nodes.add(node);
	}
	
	public void deleteNode(Node node) {
		this.nodes.remove(node);
	}
	
	public void action(Visitor visitor) {
		for(Node node:nodes) {
			node.accept(visitor);
		}
	}
	
	
}
